package pl.ydp.components.mathcell.mathrecognizer.engine.database.modelsets.math_basic.characters
{
	import pl.ydp.components.mathcell.mathrecognizer.characters.Character;
	import pl.ydp.components.mathcell.mathrecognizer.geometry.classification.PrimitiveType;
	import pl.ydp.components.mathcell.mathrecognizer.model.PrimitivesRelation;
	import pl.ydp.components.mathcell.mathrecognizer.model.RelationDescription;
	import pl.ydp.components.mathcell.mathrecognizer.model.RelationDescriptorType;
	import pl.ydp.components.mathcell.mathrecognizer.model.ShapeModel;
	import pl.ydp.components.mathcell.mathrecognizer.model.descriptors.ConnectionsDescriptor;
	import pl.ydp.components.mathcell.mathrecognizer.model.descriptors.LocationDescriptor;
	import pl.ydp.components.mathcell.mathrecognizer.model.descriptors.ObjectDescriptor;
	import pl.ydp.components.mathcell.mathrecognizer.model.descriptors.SizeDescriptor;
	import pl.ydp.components.mathcell.mathrecognizer.model.presets.PrimitivePresets;
	
	public class MB_ch_5
	{
		public static const MODELS_COUNT:Number = 2;
		
		//---------------------------------------------------
		
		public static function getModels():Array{
			
			var fiveShapeModels:Array = new Array();
			
			fiveShapeModels.push(getModel0());
			fiveShapeModels.push(getModel1());
			fiveShapeModels.push(getModel2());	
			fiveShapeModels.push(getModel3());	
			fiveShapeModels.push(getModel4());			
			
			return fiveShapeModels;
		}
		
		
		//---------------------------------------------------
		
		private static function getModel0():ShapeModel{
			var five:ShapeModel;
			var name:String = "MB_5_STD";
			var five_prim:Array = new Array();
			var five_ref:Array = new Array();
			var five_rel:Array = new Array();
			
			five_prim.push(PrimitiveType.LINE0 | PrimitiveType.LINE3 | PrimitiveType.CURVE_SOUTH, PrimitiveType.LINE2 | PrimitiveType.LINE3, PrimitiveType.CURVE_12);
			
			five_ref.push(0,1,2);
			
			five_rel.push(new RelationDescription(0,1,new PrimitivesRelation(RelationDescriptorType.CONNECTION, ConnectionsDescriptor.EXIST, 5, 
															ObjectDescriptor.END_WESTERN, ObjectDescriptor.END_NORTHERN)) );
																		
			five_rel.push(new RelationDescription(0,1,new PrimitivesRelation(RelationDescriptorType.LOCATION,LocationDescriptor.ABOVE, 10)));
			
			five_rel.push(new RelationDescription(0,1,new PrimitivesRelation(RelationDescriptorType.LOCATION,LocationDescriptor.RIGHT, 10)));
									
			
			five_rel.push(new RelationDescription(1,2,new PrimitivesRelation(RelationDescriptorType.CONNECTION, ConnectionsDescriptor.EXIST, 7, 
															ObjectDescriptor.END, ObjectDescriptor.BEGIN)) );
															
			five_rel.push(new RelationDescription(1,2,new PrimitivesRelation(RelationDescriptorType.LOCATION,LocationDescriptor.ABOVE, 10, ObjectDescriptor.COG, ObjectDescriptor.MAX_TOP)));
						
			
			five = new ShapeModel(Character.FIVE, five_prim, five_ref, five_rel, new Array(), name);
			
			return five;
			
		}
		
		//---------------------------------------------------
		
		private static function getModel1():ShapeModel{
			var five:ShapeModel;
			var name:String = "MB_5_ANGLR";
			var five_prim:Array = new Array();
			var five_ref:Array = new Array();
			var five_rel:Array = new Array();
			
			five_prim.push(PrimitiveType.LINE0 | PrimitiveType.CURVE_SOUTH, PrimitiveType.LINE2, PrimitiveType.LINE0 | PrimitiveType.LINE1, PrimitiveType.LINE3);
			
			five_ref.push(0, 1, 2, 3, PrimitivePresets.RLT_CENTER_DOT, PrimitivePresets.RLT_FULL, PrimitivePresets.RLT_UPPER_QUARTER, PrimitivePresets.RLT_BOTTOM_LEFT_SQUARE);
			
			five_rel.push(new RelationDescription(0,1,new PrimitivesRelation(RelationDescriptorType.CONNECTION, ConnectionsDescriptor.EXIST, 5, 
															ObjectDescriptor.END_WESTERN, ObjectDescriptor.END_NORTHERN)) );
			
			five_rel.push(new RelationDescription(0,1,new PrimitivesRelation(RelationDescriptorType.LOCATION,LocationDescriptor.ABOVE, 10)));
			
			five_rel.push(new RelationDescription(0,1,new PrimitivesRelation(RelationDescriptorType.LOCATION,LocationDescriptor.RIGHT, 10, ObjectDescriptor.COG, ObjectDescriptor.BEGIN)));
			
			
			five_rel.push(new RelationDescription(1,2,new PrimitivesRelation(RelationDescriptorType.CONNECTION,ConnectionsDescriptor.EXIST, 7, ObjectDescriptor.END, ObjectDescriptor.END_WESTERN)));
															
			five_rel.push(new RelationDescription(1,2,new PrimitivesRelation(RelationDescriptorType.LOCATION,LocationDescriptor.ABOVE, 10, ObjectDescriptor.HALF_BOTTOM, ObjectDescriptor.MAX_TOP)));
			
			five_rel.push(new RelationDescription(1,2,new PrimitivesRelation(RelationDescriptorType.LOCATION,LocationDescriptor.LEFT, 10, ObjectDescriptor.DEFAULT, ObjectDescriptor.HALF_LEFT)));
						
			
			five_rel.push(new RelationDescription(2,3,new PrimitivesRelation(RelationDescriptorType.CONNECTION,ConnectionsDescriptor.EXIST, 5, ObjectDescriptor.END_EASTERN, ObjectDescriptor.END_EASTERN)));
			
			five_rel.push(new RelationDescription(2,3,new PrimitivesRelation(RelationDescriptorType.LOCATION,LocationDescriptor.ABOVE, 10, ObjectDescriptor.HALF_BOTTOM, ObjectDescriptor.MAX_TOP)));
						
						
			five_rel.push(new RelationDescription(3,7,new PrimitivesRelation(RelationDescriptorType.LOCATION,LocationDescriptor.INSIDE, 5, ObjectDescriptor.END_WESTERN)));
			
			
			five = new ShapeModel(Character.FIVE, five_prim, five_ref, five_rel, new Array(), name, true);
			
			return five;
			
		}
		
		
		//---------------------------------------------------
		
		private static function getModel2():ShapeModel{
			var five:ShapeModel;
			var name:String = "MB_5_RND";
			var five_prim:Array = new Array();
			var five_ref:Array = new Array();
			var five_rel:Array = new Array();
			
			five_prim.push(PrimitiveType.LINE0 | PrimitiveType.CURVE_SOUTH, PrimitiveType.CURVE_56, PrimitiveType.CURVE_12);
			
			five_ref.push(0, 1, 2, PrimitivePresets.RLT_CENTER_DOT, PrimitivePresets.RLT_FULL, PrimitivePresets.RLT_UPPER_QUARTER);
			
			five_rel.push(new RelationDescription(0,1,new PrimitivesRelation(RelationDescriptorType.CONNECTION, ConnectionsDescriptor.EXIST, 5, 
															ObjectDescriptor.END_WESTERN, ObjectDescriptor.END_NORTHERN)) );
															
			five_rel.push(new RelationDescription(0,1,new PrimitivesRelation(RelationDescriptorType.LOCATION,LocationDescriptor.ABOVE, 10)));
			
			five_rel.push(new RelationDescription(0,1,new PrimitivesRelation(RelationDescriptorType.LOCATION,LocationDescriptor.RIGHT, 7, ObjectDescriptor.COG, ObjectDescriptor.HALF_LEFT)));
									
			five_rel.push(new RelationDescription(0,5,new PrimitivesRelation(RelationDescriptorType.LOCATION,LocationDescriptor.INSIDE, 5)));
			
			
			five_rel.push(new RelationDescription(1,2,new PrimitivesRelation(RelationDescriptorType.CONNECTION, ConnectionsDescriptor.EXIST, 7, 
															ObjectDescriptor.BEGIN, ObjectDescriptor.BEGIN)) );
			
			five_rel.push(new RelationDescription(1,2,new PrimitivesRelation(RelationDescriptorType.LOCATION,LocationDescriptor.ABOVE, 10, ObjectDescriptor.HALF_BOTTOM, ObjectDescriptor.MAX_TOP)));
			
			five_rel.push(new RelationDescription(1,2,new PrimitivesRelation(RelationDescriptorType.LOCATION,LocationDescriptor.LEFT, 10, ObjectDescriptor.COG, ObjectDescriptor.BEGIN)));
						
			five_rel.push(new RelationDescription(1,3,new PrimitivesRelation(RelationDescriptorType.LOCATION, LocationDescriptor.LEFT, 3)));
			
			
			five_rel.push(new RelationDescription(2,3,new PrimitivesRelation(RelationDescriptorType.LOCATION,LocationDescriptor.BELOW, 3)));
					
			
			five = new ShapeModel(Character.FIVE, five_prim, five_ref, five_rel, new Array(), name, true);
			
			return five;
			
		}
		
		//---------------------------------------------------
		
		private static function getModel3():ShapeModel{
			var five:ShapeModel;
			var name:String = "MB_5_RND+ANGLR";
			var five_prim:Array = new Array();
			var five_ref:Array = new Array();
			var five_rel:Array = new Array();
			
			five_prim.push(PrimitiveType.LINE0, PrimitiveType.CURVE_SW, PrimitiveType.LINE3);
			
			five_ref.push(0, 1, 2, PrimitivePresets.RLT_CENTER_DOT, PrimitivePresets.RLT_FULL, PrimitivePresets.RLT_UPPER_QUARTER, PrimitivePresets.RLT_BOTTOM_LEFT_SQUARE);
			
			five_rel.push(new RelationDescription(0,1,new PrimitivesRelation(RelationDescriptorType.CONNECTION, ConnectionsDescriptor.EXIST, 7, 
															ObjectDescriptor.BEGIN, ObjectDescriptor.END)) );
			
			five_rel.push(new RelationDescription(0,1,new PrimitivesRelation(RelationDescriptorType.LOCATION,LocationDescriptor.ABOVE, 10)));
			
			five_rel.push(new RelationDescription(0,1,new PrimitivesRelation(RelationDescriptorType.LOCATION,LocationDescriptor.RIGHT, 10, ObjectDescriptor.COG, ObjectDescriptor.END)));
						
			five_rel.push(new RelationDescription(0,5,new PrimitivesRelation(RelationDescriptorType.LOCATION,LocationDescriptor.INSIDE_WHOLE, 3)));
			
			
			five_rel.push(new RelationDescription(1,2,new PrimitivesRelation(RelationDescriptorType.CONNECTION, ConnectionsDescriptor.EXIST, 7, 
															ObjectDescriptor.BEGIN, ObjectDescriptor.BEGIN)) );
															
			five_rel.push(new RelationDescription(1,2,new PrimitivesRelation(RelationDescriptorType.LOCATION,LocationDescriptor.ABOVE, 10, ObjectDescriptor.HALF_BOTTOM, ObjectDescriptor.MAX_TOP)));
			
			five_rel.push(new RelationDescription(1,2,new PrimitivesRelation(RelationDescriptorType.LOCATION,LocationDescriptor.LEFT, 7)));
			
			five_rel.push(new RelationDescription(1,5,new PrimitivesRelation(RelationDescriptorType.SIZE, SizeDescriptor.IS_HIGHER_THAN_QUARTER, 7)));
			
			

			five_rel.push(new RelationDescription(2,5,new PrimitivesRelation(RelationDescriptorType.LOCATION,LocationDescriptor.OUTSIDE_WHOLE, 3)));
						
			five_rel.push(new RelationDescription(2,6,new PrimitivesRelation(RelationDescriptorType.LOCATION,LocationDescriptor.INSIDE, 3, ObjectDescriptor.END_WESTERN)));
			
			
			five = new ShapeModel(Character.FIVE, five_prim, five_ref, five_rel, new Array(), name, true);
			
			return five;
			
		}
		
		//---------------------------------------------------
		
		private static function getModel4():ShapeModel{
			var five:ShapeModel;
			var name:String = "MB_5_NO_LINK";
			var five_prim:Array = new Array();
			var five_ref:Array = new Array();
			var five_rel:Array = new Array();
			
			five_prim.push(PrimitiveType.LINE0, PrimitiveType.CURVE_EAST);
			
			five_ref.push(0,1, PrimitivePresets.RLT_FULL);
						
			five_rel.push(new RelationDescription(0,1,new PrimitivesRelation(RelationDescriptorType.LOCATION,LocationDescriptor.ABOVE, 10)));
			
			five_rel.push(new RelationDescription(0,1,new PrimitivesRelation(RelationDescriptorType.LOCATION,LocationDescriptor.RIGHT, 7, ObjectDescriptor.COG, ObjectDescriptor.END_NORTHERN)));
			
			five_rel.push(new RelationDescription(1,2,new PrimitivesRelation(RelationDescriptorType.LOCATION,LocationDescriptor.ABOVE, 7, ObjectDescriptor.MAX_TOP)));
			
			
			five = new ShapeModel(Character.FIVE, five_prim, five_ref, five_rel, new Array(), name);
			
			return five;
			
		}
		
		
		
		

	}
}